<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create( 'articles', function ( Blueprint $table ) {
            $table->increments( 'id' );
            $table->string( 'title' );
            $table->string('teacher');
            $table->tinyInteger('age');
            $table->string('education');
            $table->string('sentence');
            $table->string( 'category' );
            $table->text( 'content' );
            $table->string('picture')->default('');
            $table->tinyInteger('experience')->default(0);
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP(0)'));
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP(0)'));
        } );

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
